home *** CD-ROM | disk | FTP | other *** search
- /* GetCSAMIcon.c */
- /*
- * GetCSAMIcon.c
- * Copyright © 1992-93 Apple Computer Inc. All Rights Reserved.
- *
- * Read an icon suite (a vector of icon handles) into the
- * system heap. Note that this is called only by the OpenDRVR
- * function, and at a time when the Memory Manager and Resource
- * Manager may be called.
- */
- #include "DTSSampleCSAM.h"
-
- /*
- * Load one icon into the private storage area.
- */
- OSErr
- GetCSAMIcon(
- DTSSampleCSAMInfoPtr infoPtr,
- short i
- )
- {
- OSErr status;
- Handle iconHdl;
- register IconInfoPtr iconInfoPtr;
- ResType iconType;
- #define ICON (*iconInfoPtr)
-
- /*
- *** MPW can't store a const vector in the
- *** code segment.
- */
- switch (i) {
- case 0: iconType = large1BitMask; break;
- case 1: iconType = large8BitData; break;
- case 2: iconType = large4BitData; break;
- case 3: iconType = small8BitData; break;
- case 4: iconType = small4BitData; break;
- default:
- case 5: iconType = small1BitMask; break;
- }
- iconHdl = GetResource(iconType, kIconID);
- if (iconHdl == NULL)
- status = resNotFound;
- else {
- DetachResource(iconHdl);
- status = ResError();
- }
- if (status == noErr) {
- MoveHHi(iconHdl);
- status = MemError();
- }
- if (status == noErr) {
- HLock(iconHdl);
- status = MemError();
- }
- if (status == noErr) {
- iconInfoPtr = &INFO.icons[i];
- ICON.iconData = iconHdl;
- ICON.iconType = iconType;
- ICON.iconLength = GetHandleSize(iconHdl);
- status = MemError();
- }
- LogError('GetI', status);
- return (status);
- #undef ICON
- }
-
-